<?php
require './include/global.php';
require './include/validate.php';
require './include/all_left.php';

require_once './include/advisory_db.php';
//print_r($_SESSION);
$smarty->compile_check = true;

$rs[re_id] = $_GET[id];

$smarty->display('header.tpl');
//'option'=>$jobcategory

$_GET[view]=="op"&&$rs = $DB->fetch_one_array("SELECT * FROM pa_resume WHERE `re_id` =".$rs[re_id] ." AND ( `re_private` <> 1 OR ( `re_private` = 1  AND `re_uid` = '".$_SESSION['uid']."')) " );
if($rs[re_id] == ''|| $_GET[view]!="op"){
   $err = "Invalid ID! You have no permisson to view this page.";
   $smarty->assign("err",$err);
   $smarty->display("left.tpl");
   $smarty->display("error.tpl");
   $smarty->display("right.tpl");
   $smarty->display('footer.tpl');
   exit;
}

if($rs[re_private] == 1 && $rs['re_uid'] != $_SESSION['uid']){
   $err = "You cannot access this page!";
   $smarty->assign("err",$err);
   $smarty->display("left.tpl");
   $smarty->display("error.tpl");
   $smarty->display("right.tpl");
   $smarty->display('footer.tpl');
   exit;
}

if($rs[re_aliasname]!='') $aliasname = "   (".$rs[re_aliasname].")";
if($rs[re_usertype] == 'recruiter'){
$smarty->assign("name",$rs[re_nickname]);
}else{
$smarty->assign("name",$rs[re_fname]." ".$rs[re_lname].$aliasname);
}
$smarty->assign("imgurl",$rs[re_upload]);

if($rs[re_aliasname]!=''){$fid=$rs[re_fid];$rid = $rs[re_fid];}else{$fid=$rs[re_id];$rid = $rs[re_id];}

if(!file_exists("./uploadfiles/resumes/$rs[re_upload]")||$rs[re_upload]==''){
   $rs[re_upload] = "noimages.jpg";
}

ob_clean();
ob_start();
            $view =1;
		   //$cpforms->getimage(array('view'=>"$view"));
		   //echo '<div style="position:absolute;margin:30px 0 0 400px;padding:0"><img src="uploadfiles/resumes/'.$rs[re_upload].'" width="120" height="120" style="border:1px solid orange"></div>';
		    $cpforms->formheader(array ('title' => 'Candidate Record','name' => 'article','enctype' => 'multipart/form-data'));
			$cpforms->makehidden(array ('name' => 'action','value' => 'resume_doupdate'));
			$cpforms->makehidden(array ('name' => 'editid','value'=> $_GET[id]));
			//
			//$cpforms->gethightext(array ('text' => "Create Date",'value' => @date("m/d/Y",$rs[re_regtime]), 'view' => 1));
		   // if($rs[re_updtime]==0){$rs[re_updtime] = $rs[re_regtime];}
			//$cpforms->gethightext(array ('text' => "Last Update",'value' => @date("m/d/Y",$rs[re_updtime]), 'view' => 1));
			//$cpforms->gethightext(array ('text' => "User Type",'value' =>"$rs[re_usertype]", 'view' => 1));
			//$cpforms->makeselect(array ('text' => "Job Search Status",'name' => "re_jobsearchstatus",'option' => $jobSearchStatus,'selected' =>$rs[re_jobsearchstatus],'view' => "$view" ,'icon'=>"'Indicate  job search status.  You may edit this later.', WIDTH, 200, SHADOW, true",'viewfunction' => 'jobSearchStatus'));
            //
			if($rs[re_updtime]==0){$rs[re_updtime] = $rs[re_regtime];}
			$jobSearchStatus[$rs[re_jobsearchstatus]] = ($rs[re_jobsearchstatus]==0)?"N/A":$jobSearchStatus[$rs[re_jobsearchstatus]];
			echo
			'<tr><td colspan="2" class="tbhead" style="margin:0;padding:0">
			<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">
			<tr class="firstalt" nowrap><td width="40%" >Create Date:</td><td  width="30%" >'. @date("m/d/Y",$rs[re_regtime]).'</td><td rowspan="4" width="30%" ><img src="uploadfiles/resumes/'.$rs[re_upload].'" width="120" height="120" style="border:1px solid orange"></td></tr>
			<tr class="firstalt" nowrap><td >Last Update:</td><td  >'.@date("m/d/Y",$rs[re_updtime]).'</td></tr>
			<tr class="firstalt" nowrap><td >User Type:</td><td >'.$rs[re_usertype].'</td></tr>
			<tr class="firstalt" nowrap><td >Job Search Status:</td><td  >'.$jobSearchStatus[$rs[re_jobsearchstatus]].'</td></tr>
            </table>
            </td>
            </tr>';
			$cpforms->longline(array('title'=>"Contact Information"));
			/*
			if($rs[re_uid] == $_SESSION[uid]||$rs[re_usertype] <> 'recruiter'){
			$cpforms->gethightext(array ('text' => "First Name",'name' => "re_fname",'value' => "$rs[re_fname]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Last Name",'name' => "re_lname",'value' => "$rs[re_lname]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Nick Name",'name' => "re_nickname",'value' => "$rs[re_nickname]",'view' => "$view",'icon'=>"'Type a nick name for this candidate. When you submit this candidate profile to a job, this Nick Name will be displayed.', WIDTH, 200, SHADOW, true"));		

			$cpforms->gethightext(array ('text' => "Contact Email",'name' => "re_email",'value' => "$rs[re_email]",'view' => "$view",'email'=>1));
			$cpforms->gethightext(array ('text' => "Street Address 1",'name' => "re_address1",'value' => "$rs[re_address1]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Street Address 2",'name' => "re_address2",'value' => "$rs[re_address2]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Location - City",'name' => "re_locity",'value' => "$rs[re_locity]",'view' => "$view"));
			$cpforms->makeselect(array ('text' => "Location - State",'name' => "re_lostate",'option' => $state,'selected' => "$rs[re_lostate]",'view' => "$view",'viewfunction' => 'state'));
			$cpforms->makeselect(array ('text' => "Location - Country",'name' => "re_locountry",'option' => $country,'selected' => "$rs[re_locountry]",'view' => "$view",'viewfunction' => 'country'));
			$cpforms->gethightext(array ('text' => "Primary Phone",'name' => "re_phone1",'value' => "$rs[re_phone1]",'view' => "$view"));
			//$cpforms->gethightext(array ('text' => "Recruiter Contact",'name' => "re_phone2",'value' => "$rs[re_phone2]",'view' => "$view"));
			}
			*/

		    $cpforms->maketextarea(array ('text' => "Recruiter Contact",'name' => "re_phone2",'value' => "$rs[re_phone2]",'view' => "$view",'email'=>1));
			
			if($rs[re_uid] == $_SESSION[uid]||$rs[re_usertype] <> 'recruiter'){
				//$cpforms->makefck(array ('text' => "Comments",'name' => "re_rccomment",'id'=>"re_rccomment",'only' => 0,'value' => $rs[re_rccomment],'view' => "$view",'icon'=>"'Add notes or comments about this candidate here.', WIDTH, 200, SHADOW, true"));	
			}
		

			$cpforms->longline(array('title'=>"Desired Job Detail"));
			$cpforms->makeselect(array ('text' => "Desired Job Type",'name' => "re_jobtype",'option' => $jobtype,'selected' => "$rs[re_jobtype]",'view' => "$view"));
			$cpforms->makeselect(array ('text' => "Desired Job Industry",'name' => "re_jobindustry",'option' => $jobcategory,'selected' => "$rs[re_jobindustry]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Desired Job Title",'name' => "re_jobtitle",'value' => "$rs[re_jobtitle]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Current Base Pay",'name' => "re_currentpay",'value' => "$rs[re_currentpay]",'view' => "$view",'icon'=>"'Indicate current annual base salary', WIDTH, 200, SHADOW, true","prev"=>"$"));
			$cpforms->gethightext(array ('text' => "Desired Base Pay",'name' => "re_desiredpay",'value' => "$rs[re_desiredpay]",'view' => "$view",'icon'=>"'Indicate desired annual base salary', WIDTH, 200, SHADOW, true","prev"=>"$"));
			$cpforms->maketextarea(array ('text' => "Other Compensation/Benefits",'name' => "re_benefits",'value' => stripslashes($rs[re_benefits]),'view' => "$view",'icon'=>"'Indicate other preferred compensation or benefits such as sign-on bonus or stock grants.  ', WIDTH, 200, SHADOW, true"));
			$cpforms->longline(array('title'=>"Qualifications"));
			$cpforms->maketextarea(array ('text' => "Schools Attended",'name' => "re_schoolattend",'value' => stripslashes($rs[re_schoolattend]),'view' => "$view"));

			$cpforms->makeselect(array ('text' => "Highest Education Level",'name' => "re_edulevel",'option' => $education,'selected' => "$rs[re_edulevel]",'view' => "$view",'viewfunction' => 'education','icon'=>"' Indicate the highest level of education achieved here.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "Professional Licenses/Certification",'name' => "re_proflicense",'value' => "$rs[re_proflicense]",'view' => "$view",'icon'=>"'List all professional licenses or certifications obtained here.', WIDTH, 200, SHADOW, true"));
			$cpforms->makeselect(array ('text' => "Years of Work Experience",'name' => "re_yearexp",'option' => $yearexp2,'selected' => "$rs[re_yearexp]",'view' => "$view",'viewfunction' => 'yearexp'));			
			$cpforms->makeselect(array ('text' => "Years of People Mgmt Experience",'name' => "re_mgmt",'option' => $yearexp2,'selected' => "$rs[re_mgmt]",'view' => "$view",'viewfunction' => 'yearexp'));
			$cpforms->makeselect(array ('text' => "Years of Profit & Loss Responsibility",'name' => "re_profit",'option' => $yearexp2,'selected' => "$rs[re_profit]",'view' => "$view",'viewfunction' => 'yearexp'));
			$cpforms->gethightext(array ('text' => "Spoken Language(s)",'name' => "re_spoken",'value' => "$rs[re_spoken]",'view' => "$view"));
			$cpforms->gethightext(array ('text' => "Programming Language Knowledge",'name' => "re_prolang",'value' => "$rs[re_prolang]",'view' => "$view"));
			$cpforms->gethighradio(array ('text' => "High-Tech Patent/IP owner or Co-owner?",'name' => "re_ip",'selected' => "$rs[re_ip]",'view' => "$view"));
			$cpforms->gethighradio(array ('text' => "U.S.Government Security Clearance?",'name' => "re_ussecurity",'selected' => "$rs[re_ussecurity]",'view' => "$view"));
			//$cpforms->gethightext(array ('text' => "Indicate in which country the candidate is authorized to work.",'name' => "re_authorize",'value' => $rs[re_authorize],'view' => "$view",'icon'=>"'Indicate  job search status.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->maketextarea(array ('text' => "Authorized to work in the following country",'name' => "re_authorize",'value' => "$rs[re_authorize]",'view' => "$view" ,'icon'=>"' Indicate in which country the candidate is authorized to work.', WIDTH, 200, SHADOW, true"));
			$cpforms->maketextarea2(array ('text' => "Resume Detail",'name' => "re_detail",'value' => stripslashes($rs[re_detail]),'view' => "$view",'icon'=>"' Please include details of all relevant work experience, education and training here.  You can type-in your content or cut and paste them.  Please DO NOT include your name or contact information here.', WIDTH, 200, SHADOW, true"));
            if($_SESSION[usertype]=="candidate"||$rs[re_usertype]=="candidate"){
			$cpforms->longline(array('title'=>"More About Me…"));
			$cpforms->gethightext(array ('text' => "My family/friends would describe me as…",'name' => "re_describeme",'value' => "$rs[re_describeme]",'view' => "$view",'icon'=>"'Please describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "My favoriate book is…because…",'name' => "re_favoriatebook",'value' => "$rs[re_favoriatebook]",'view' => "$view",'icon'=>"'Please describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "My highest achievement is…",'name' => "re_highachieve",'value' => "$rs[re_highachieve]",'view' => "$view",'icon'=>"'Please describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "In 3 to 5 years, I plan to…",'name' => "re_iplan",'value' => "$rs[re_iplan]",'view' => "$view",'icon'=>"'Please describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "When I'm not working I like to…",'name' => "re_iliketo",'value' => "$rs[re_iliketo]",'view' => "$view",'icon'=>"'Please describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
			$cpforms->gethightext(array ('text' => "My Personal Website or Blog Link ",'name' => "re_personalweb",'value' => "$rs[re_personalweb]",'view' => "$view",'icon'=>"'etc. http://www.enetrecruiter.com', WIDTH, 200, SHADOW, true"));
			$cpforms->maketextarea(array ('text' => "Comments",'name' => "re_comments",'value' => stripslashes($rs[re_comments]),'view' => "$view",'icon'=>"'You may include additional comments here for view by recruiters.', WIDTH, 200, SHADOW, true"));
		 	//$cpforms->makefile(array ('text' => "Picture (Upload an image size 100×100)",'name' => "uploadfile",'value'=>"$re_upload",'url'  => "uploadfiles/resumes/",'view' => "$view"));
		    }
			/* hidden
		    if($_SESSION[usertype]=="recruiter"&&$rs[re_uid]==$_SESSION[uid]){
		    $cpforms->longline(array('title'=>"Work Status, Employment and Professional References"));
			$cpforms->maketextarea(array ('text' => "Three Previous Employers",'name' => "re_prvemployer",'value' => "$rs[re_prvemployer]",'view' => "$view",'icon'=>"'Please list 3 previous employers.', WIDTH, 200, SHADOW, true"));
		    $cpforms->gethighradio(array ('text' => "Previous Employment Status Checked?",'name' => "re_prvempstatus",'selected' => "$rs[re_prvempstatus]",'view' => "$view",'icon'=>"'You are not required to perform employment status checking prior to submitting the applicant.  But it may improve your applicant\'s chances of being considered before other applicants.  Be ready to provide the necessary information if requested by the employer.', WIDTH, 200, SHADOW, true"));
			 $cpforms->gethighradio(array ('text' => "Three Professional References Available?",'name' => "re_professavilable",'selected' => "$rs[re_professavilable]",'view' => "$view",'icon'=>"'Does the applicant have a minimum of 3 references available to speak of his/her past work performance?  This is not required but may improve your applicant\'s chances of being considered before others.  Be ready to provide the necessary information if asked by the employer.', WIDTH, 200, SHADOW, true"));
			  //$cpforms->gethighradio(array ('text' => "Will the applicant require work sponsorship for this job?",'name' => "re_sponsorship",'selected' => "$rs[re_sponsorship]",'view' => "$view"));
		   }

	   if($_SESSION[uid] == $rs[re_uid] && $rs[re_usertype]=="recruiter" && $_SESSION['status'] == "Premium") $alias = "alias";
	   if($_SESSION[uid] == $rs[re_uid]) $editButton = 1;
	   **/
       $cpforms->noformfooter($alias,$fid,$_GET[action],$_GET[alias],$editButton);
			$reg_data = ob_get_contents();
ob_end_clean();

$smarty->assign('title',$title);

if($err!=''){
$smarty->assign("err",$err);
}

/*hidden
if($_SESSION[uid] == $rs[re_uid] && $rs[re_usertype]=="recruiter" && $_SESSION['status'] == "Premium"){
	$smarty->assign("aliasbutton",'<span style="float:right;padding: 0 10px 0 0 "><input type="button" value="Create Alias" onclick="location.href=\'postresumealias.php?id='.$rid.'\'"> <a href="###" onmouseover="Tip(\'You may create up to 99  alias copies of this candidate record.\', WIDTH, 200, SHADOW, true)"><img src="images/icn_question.jpg" border="0" align="absmiddle" /></a></span>');
	$smarty->assign("editbutton",'<span style="float:right;padding: 0 10px 0 0 "><input type="button" value=" Edit " onclick="location.href=\'postresume.php?action=edit&id='.$rid.'\'"></span>');
	$smarty->assign("publicviewbutton",'<span style="float:right;padding: 0 10px 0 0 "><input type="button" value=" Public View " onclick="location.href=\'publicviewresume.php?action=op&id='.$rid.'\'"></span>');
	

}
*/
$rs['re_mgmt'] = $yearexp2[$rs['re_mgmt']];
$rs['re_profit'] = $yearexp2[$rs['re_profit']];
$rs['re_edulevel'] = $education[$rs['re_edulevel']];
$rs['re_jobindustry'] = $jobcategory[$rs['re_jobindustry']];
$rs['re_jobsearchstatus'] = $jobSearchStatus[$rs[re_jobsearchstatus]];
$rs['re_regtime'] = @date("m/d/Y",$rs[re_regtime]);
$rs['re_lostate'] = $state[$rs['re_lostate']];
$rs['re_locountry'] = $country[$rs['re_locountry']];


$smarty->assign("rs",$rs);

$smarty->assign("reg",$reg_data);
$smarty->display('allleft.tpl');
$smarty->display('resumeaction.tpl');


$smarty->display('allright.tpl');
$smarty->display('footer.tpl');

?>
